package com.ruoyi.app.controller.product.mapper;

import com.ruoyi.common.core.dao.BaseMapper;
import com.ruoyi.common.entity.DO.product.ShopProductAttributeDO;
import com.ruoyi.common.entity.DO.product.ShopProductConfigDO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface IShopProductConfigMapper extends BaseMapper<ShopProductConfigDO> {
    @Select("SELECT config_value FROM shop_product_config WHERE config_flag=#{configFlag} and shop_id=#{shopId} and product_id=#{productId} and is_enable=1 and is_delete=0 LIMIT 1")
    String getConfigValueByFlag(@Param("configFlag") String configFlag, @Param("shopId") Long shopId, @Param("productId") Long productId);

    @Select("SELECT config_value configValue,config_flag configFlag,product_id productId FROM shop_product_config WHERE config_group=#{configGroup} and shop_id=#{shopId} and product_id=#{productId} and is_enable=1 and is_delete=0")
    List<ShopProductConfigDO> getConfigListByGroup(@Param("configGroup") String configGroup, @Param("shopId") Long shopId,@Param("productId") Long productId);
}
